package com.genius.reservation.reservation.service;

import com.alibaba.fastjson.JSONObject;
import com.genius.reservation.common.ResponseRule;
import com.genius.reservation.reservation.entity.ReservationInformation;
import com.baomidou.mybatisplus.extension.service.IService;
import com.genius.reservation.user.entity.UserInformation;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 预约信息 服务类
 * </p>
 *
 * @author baomidou
 * @since 2022-05-26
 */
public interface IReservationInformationService extends IService<ReservationInformation> {

    ResponseRule createReservation(String orderNumber,String supplierNumber,String supplierName);

    ResponseRule submitReservation( String reservationNumber,
                                    String itemNum,
                                    String number,
                                    String month,
                                    String time,
                                    String cars,
                                    String[] orderNumbers,
                                    String supplierName,
                                    String supplierNumber,
                                    String reservationName);
    ReservationInformation actualArrivalTime(ReservationInformation reservation);
    ReservationInformation actualPlatformTime(ReservationInformation reservation);

    ReservationInformation actualReceiver(ReservationInformation reservation);

    ResponseRule cancelReceiver(String reservationNumber);

    ResponseRule editReservation(ReservationInformation reservation);

    JSONObject getAllReservation(int page,int limit);

    ResponseRule finishReservationSupplier(String reservationNumber);

    ResponseRule finishReservationReceiver(String reservationNumber);

    ReservationInformation getByReservationNumber(String reservationNumber);

//    ReservationInformation getBy
    ResponseRule findFreePlatform();

    ResponseRule findFreeReceiver();

//    ResponseRule changePlatform(String reservationNumber,String platformNumber);

    default ReservationInformation addAndUp(ReservationInformation reservation){
        this.saveOrUpdate(reservation);
        return reservation;
    }


    ResponseRule findReservationBySupplier(String supplierNumber);

    ResponseRule findReservationBySupplierFive(String supplierNumber);

    ResponseRule findReservationByDriver(String driverNumber);

    List<ReservationInformation> findReservationByDriverList(String driverNumber);

    ResponseRule findReservationByDriverFive(String driverNumber);

    ResponseRule findReservationByReceiver(String receiverNumber);

    ResponseRule findReservationByReceiverFive(String receiverNumber);


    ResponseRule findReservation(String reservationNumber);

    ResponseRule getIncompleteReservationByReceiver(String receiverNumber);
    ResponseRule getIncompleteReservationByReceiverByStartCar(String receiverNumber);

    ResponseRule getFinishReservationByReceiverByStartCar(String receiverNumber);
    ResponseRule getUncompletedReservation();
    ResponseRule getCompleteReservation();
    ResponseRule getLateReservation();
    ResponseRule getUnlateReservation();

    ResponseRule checkUsedTime(String year,String month,String day,String hour);
    ResponseRule checkUsedReceiver(String year,String month,String day,String hour);


    ResponseRule checkTimeIsUse(String startTime,String overTime,String platformNumber);

    ResponseRule checkReceiverIsUse(String startTime,String overTime,String receiverNumber);


    ResponseRule freePlatformByTime(String startTime,Integer keepTime);

    ResponseRule freeReceiverByTime(String startTime,Integer keepTime);

    JSONObject searchTable(String key,String value,int page,int limit);

    ResponseRule getReservationByOrder(String orderNumber);

    ResponseRule getAllFreeReceiverByTime(String startTime,Integer keepTime);


    ResponseRule getAllFreePlatformByTime(String startTime,Integer keepTime);

    @Deprecated
    ResponseRule getBilOrder(String supplierNumber);

    ResponseRule getBoxamount(String reservationNumber);
    ResponseRule getUnReservationOrders(String supplierNumber);
    Map<String,Object> getUnReservationOrder(String orderNnumber);
    ResponseRule createReservationRetQRcode(String supplierNumber,String orderNumber);

    ResponseRule confirmReservation(String reservationNumber,String confirmArrivalTime, String confirmOverTime, Integer trayCount, List<JSONObject> cars);
}
